package com.zack.gank.gankandroid.sexy;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.text.StaticLayout;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;

import com.zack.gank.gankandroid.gankandroid.R;
import com.zack.gank.gankandroid.main.find.bean.Gank;
import com.zack.gank.gankandroid.main.main.adapter.SeaxyAdapter;
import com.zack.gank.gankandroid.sexy.adapter.SexyDetailAdapter;
import com.zack.gank.gankandroid.utils.AlphaPageTransformer;
import com.zack.gank.gankandroid.utils.ZoomOutPageTransformer;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Android on 2017/7/24.
 */

public class SexyDetailActivity extends AppCompatActivity implements SexyChagneBgInterface{
    @BindView(R.id.vp_sexy)
    ViewPager vpSexy;
    @BindView(R.id.viewPager_layout)
    LinearLayout viewPagerContainer  ;
    SexyDetailAdapter adapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sexy_detail);
        ButterKnife.bind(this);
        ArrayList<Gank> ganks= (ArrayList<Gank>) getIntent().getBundleExtra("gank").getSerializable("ganks");
        com.orhanobut.logger.Logger.i(ganks.size()+"  "+ganks.get(0).url);
        adapter = new SexyDetailAdapter(this,ganks);
        vpSexy.setOffscreenPageLimit(3);
        vpSexy.setPageMargin(this.getResources().getDimensionPixelOffset(R.dimen.sexy_vp_margin));
        vpSexy.setAdapter(adapter);
        vpSexy.setPageTransformer(false,new ZoomOutPageTransformer());

        vpSexy.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {

            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
    }

    @Override
    public void getPaletteColor(int colorInt) {
        viewPagerContainer.setBackgroundColor(colorInt);
    }
}
